package com.feishi.core.util.queue.feishi;


import com.feishi.core.util.queue.Producer;
import com.feishi.core.util.queue.Customer;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by caixq on 4/26 026.
 */
public class FeishiQueueUtil {
    private static ExecutorService pool = Executors.newCachedThreadPool();
    public static <T,R> Producer<Msg<T,R>> getProductor(Customer<Msg<T,R>> customer){
        if(pool.isShutdown()){
            pool = Executors.newCachedThreadPool();
        }
        return new FeishiProducer<>(customer, pool);
    }
}
